<template>
  <div>
    <BasicTable @register="registerTable" :searchInfo="searchInfo"></BasicTable>
  </div>
</template>
<script lang="ts" setup>
import { BasicTable } from '@apps/antd-admin/src/components/Table';
import { Api } from './data/api';
import { columns, searchFormSchema } from './data/data';
import { useMessage } from '@apps/antd-admin/src/hooks/web/useMessage';
import { reactive } from 'vue';
import { useBaseTable } from '@apps/antd-admin/src/hooks';

const { createMessage } = useMessage();
const { prefixCls, tableContext, handleDelete, handleSuccess, handlePost, handleBatchDelete } = useBaseTable({
  designScope: 'orderoptlog-template',
  tableProps: {
    //表格标题
    title: '订单操作日志列表',
    //主键字段
    rowKey: 'orderOptlogId',
    //列表接口
    listUrl: Api.page,
    //删除接口
    delUrl: Api.remove,
    //列定义
    columns,
    //查询表单配置
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    //操作列配置
    actionColumn: {
      width: 80,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
      fixed: 'right',
    },
  },
});

const [registerTable, { reload }, { rowSelection, hasSelectedRows }] = tableContext;

const searchInfo = reactive<Recordable>({});

function setSearchInfoProps(orderId) {
  searchInfo.orderId = orderId;
}

defineExpose({
  setSearchInfoProps,
});
</script>
